package com.centerm.common.constant.enums;

import com.centerm.common.constant.StatusCode;

/**
* @Description 
* 	ACTIVITY_LIB(1, "活动库"),<br />
	DEFINED_PROCESS(2, "已定义过程"),<br />
	PROJECT(3, "项目管理"),<br />
	PROCESS(4, "活动管理"),<br />
	TASK(5, "任务管理"),<br />
	LOG(6, "日志管理"),<br />
* @author Fly
* @date 2017年8月9日
 */
public enum ModelType implements StatusCode {
	ACTIVITY_LIB(1, "活动库"),
	MILESTONE(2, "里程碑管理"),
	PROJECT(3, "项目管理"),
	PROCESS(4, "活动管理"),
	TASK(5, "任务管理"),
	LOG(6, "日志管理"),
	;
	
	private Integer code;
	private String description;
	
	
	ModelType(Integer code, String description) {
		this.code = code;
		this.description = description;
	}


	@Override
	public Integer getCode() {
		return this.code;
	}


	@Override
	public String getDescription() {
		return this.description;
	}

	public static StatusCode getByCode(Integer code) {
		for(ModelType modelType : ModelType.values()) {
            if(modelType.getCode().equals(code)) {
                return modelType;
            }
        }
        return null;
	}


	public static String getDescriptionByCode(Integer code) {
		for(ModelType modelType : ModelType.values()) {
            if(modelType.getCode().equals(code)) {
                return modelType.getDescription();
            }
        }
        return null;
	}
}
